/**
 * OSS is a Open Service Container which gives the leverage of building the Desktop and Web
 * Application. * Copyright (C) 2008-2009  Ponraj Sutanthiramani
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Or5e Open Source Community
 * Navigator Bldg, ITPL, Bangalore, India.
 */

package org.or5e.api.calendar;

import java.io.File;

/**
 *
 * @author Ponraj Suthanthiramani
 */
public class DataFileLoaderBuilder {
    private DataFileLoader _loader;
    public DataFileLoader buildDataFileLoader(String fileName) throws CalendarException{
        if(!fileName.endsWith("xls")) {
            throw new CalendarException(CalendarExceptionConstants.E003);
        }
        if(fileName.endsWith("xls")) {
            _loader = new LoadXLFile();
            _loader.setLoadFile(new File(fileName));
            _loader.setType("Excel");
        }
        return _loader;
    }
    public static void main(String[] args) throws CalendarException {
        DataFileLoaderBuilder builder = new DataFileLoaderBuilder();
        builder._loader = new DataFileLoaderBuilder().buildDataFileLoader("outlook/Calendar.xls");
        builder._loader.loadEntry();
    }
}
